package com.yf.yfmovieapp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yf.yfmovieapp.mapper.UserMapper;
import com.yf.yfmovieapp.pojo.User;
import com.yf.yfmovieapp.service.UserService;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * @Author Yang_Vincent
 * @Date 2020/8/29 10:56
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    @Cacheable(cacheNames = "userInfo")
    public User getUserIssTrue(String username, String password) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("username", username);
        wrapper.eq("password", password);
        return this.baseMapper.selectOne(wrapper);
    }
}
